<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var a
        //声明提升
        //1.把声明提升到当前作用域顶端
        //2.值留在原地
        console.log(a)
        a = 10
        //用var 声明的变量，会产生声明提升
        //---------------------------------------------------------
        console.log('---------------------------------------------------------')
        //如果函数声明不是匿名函数，那么函数体会被提升到作用域顶端
        console.log(func)
        func()

        function func() {
            console.log('函数执行了')
        }
    </script>
</body>

</html>